 /****** Object:  Stored Procedure ResponsibleOfficesGetList    Script Date: Monday, November 26, 2007 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spResponsibleOfficesGetListByConpoint]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [spResponsibleOfficesGetListByConpoint]
GO

	
	
CREATE PROCEDURE spResponsibleOfficesGetListByConpoint	
	@ConPointID int	
AS

SELECT
	[ResponsibleOffices].[ResponsibleID],
	[ResponsibleOffices].[DefaultToOfficeID],
	ISNULL((SELECT DISTINCT 1 FROM ShippingStatusReport WHERE ShippingStatusReport.[ResponsibleID] = [ResponsibleOffices].[ResponsibleID]), 0) AS IsInUse
FROM
	[ResponsibleOffices] LEFT JOIN Responsibles ON [ResponsibleOffices].[ResponsibleID] = Responsibles.[ResponsibleID]	
WHERE @ConPointID = Responsibles.ConPointID

GO

	
